/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * 
 * Copyright 2010 yura, Version 2.0 (the "License");
 *
 * you may not use this file except in compliance with the License.
 *
 * You may obtain a copy of the License at
 *
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * 
 * Unless required by applicable law or agreed to in writing, software
 *
 * distributed under the License is distributed on an "AS IS" BASIS,
 *
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and
 *
 * limitations under the License.
 */

package org.opu.doc2db.document.datadocument;

import java.util.Collection;

/**
 *  Paragraph thet only have text blocks
 * 
 * @author yura
 */
public class TextParagraph extends ParagraphList<TextBlock> {

    /**
     *  Create list with all argument
     *
     * @param id id of paragraph
     * @param elements elements collections
     */
    public TextParagraph(String id,
            Collection<TextBlock> elements) {
        super(id, elements);
        dataSeparator = "";
    }

    /**
     *  Create list with 0 paragraph<br>
     *<pre>
     *    this(0, elements);
     *</pre>
     * @param elements
     */
    public TextParagraph(Collection<TextBlock> elements) {
        this("", elements);
    }

    /**
     *  Create list withoute data, but with paragraph identificator
     *
     * @param id id of paragraph
     */
    public TextParagraph(String id) {
        this(id, null);
    }

    /**
     *  create empte list without arguments
     *<pre>
     *    this(null);
     *</pre>
     */
    public TextParagraph() {
        this("", null);
    }

    /**
     *  Returns an array containing all of the elements
     * in paragraphs (texts) list
     *
     * @return array containing all of the text blocks
     */
    public TextBlock[] textBlocksToArray() {
        Object[] obj = elements.toArray();
        TextBlock[] ret = new TextBlock[obj.length];

        System.arraycopy(obj, 0, ret, 0, obj.length);

        return ret;
    }

}
